package com.wisely.xxboot.batch;

import com.wisely.xxboot.domain.BatchPerson;
import org.springframework.batch.item.validator.ValidatingItemProcessor;
import org.springframework.batch.item.validator.ValidationException;

/**
 * <p>Description:</p>
 * <p>Copyright: Copyright (c) 2017</p>
 * <p>Company: 中视数讯</p>
 * <p>Site: www.digi-zones.com</p>
 *
 * @author shengping
 * @version 1.0
 * @date 2017/7/3
 */
public class CsvItemProcessor extends ValidatingItemProcessor<BatchPerson> {
    @Override
    public BatchPerson process(BatchPerson item) throws ValidationException {
        super.process(item);//1 需要执行suer.process才会调用自定义校验器
        if(item.getNation().equals("汉族")){ //2 对数据进行简单处理
            item.setNation("01");
        }else{
            item.setNation("02");
        }
        return item;
    }
}
